<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Paperclip::Processor</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Paperclip::Processor</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/paperclip/lib/paperclip/processor_rb.html">
                vendor/plugins/paperclip/lib/paperclip/processor.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
<a href="../Paperclip.html">Paperclip</a> processors allow you to modify
attached files when they are attached in any way you are able. <a
href="../Paperclip.html">Paperclip</a> itself uses command-line programs
for its included <a href="Thumbnail.html">Thumbnail</a> processor, but
custom processors are not required to follow suit.
</p>
<p>
Processors are required to be defined inside the <a
href="../Paperclip.html">Paperclip</a> module and are also required to be a
subclass of <a href="Processor.html">Paperclip::Processor</a>. There is
only one method you <b>must</b> implement to properly be a subclass: <a
href="Processor.html#M000093">make</a>, but initialize may also be of use.
Both methods accept 3 arguments: the file that will be operated on (which
is an instance of File), a hash of options that were defined in
has_attached_file&#8216;s style hash, and the <a
href="Attachment.html">Paperclip::Attachment</a> itself.
</p>
<p>
All <a href="Processor.html#M000093">make</a> needs to return is an
instance of File (<a href="Tempfile.html">Tempfile</a> is acceptable) which
contains the results of the processing.
</p>
<p>
See <a href="../Paperclip.html#M000008">Paperclip.run</a> for more
information about using command-line utilities from within Processors.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000094">make</a>&nbsp;&nbsp;
      <a href="#M000093">make</a>&nbsp;&nbsp;
      <a href="#M000092">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">attachment</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">file</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">options</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000094" class="method-detail">
        <a name="M000094"></a>

        <div class="method-heading">
          <a href="#M000094" class="method-signature">
          <span class="method-name">make</span><span class="method-args">(file, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000094-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/processor.rb, line 32</span>
32:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">make</span> <span class="ruby-identifier">file</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">attachment</span> = <span class="ruby-keyword kw">nil</span>
33:       <span class="ruby-identifier">new</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">attachment</span>).<span class="ruby-identifier">make</span>
34:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000092" class="method-detail">
        <a name="M000092"></a>

        <div class="method-heading">
          <a href="#M000092" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(file, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000092-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/processor.rb, line 23</span>
23:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">file</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">attachment</span> = <span class="ruby-keyword kw">nil</span>
24:       <span class="ruby-ivar">@file</span> = <span class="ruby-identifier">file</span>
25:       <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
26:       <span class="ruby-ivar">@attachment</span> = <span class="ruby-identifier">attachment</span>
27:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000093" class="method-detail">
        <a name="M000093"></a>

        <div class="method-heading">
          <a href="#M000093" class="method-signature">
          <span class="method-name">make</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000093-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/paperclip/lib/paperclip/processor.rb, line 29</span>
29:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make</span>
30:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>